import React, {
  Component
} from 'react';
import {
  StyleSheet,
  Text,
  View
} from 'react-native';
import NavigationBar from 'react-native-navbar';
import TopBar from '../components/TopBar';

//组件开始
class Login extends Component {
  constructor(props) {
    super(props);
    this.state = {};

  }

  _pressButton() {
    const {
      navigator
    } = this.props;
    if (navigator) {
      //很熟悉吧，入栈出栈~ 把当前的页面pop掉，这里就返回到了上一个页面:FirstPageComponent了
      navigator.pop();
    }
  }

  render() {
    return (
      <View style={styles.container}>

      <TopBar 
          title='登录' 
          leftButton={{ 
            title: '返回',
            handler: this._pressButton.bind(this),
          }} 
        />

          <Text style={styles.description}>
             用户登录
          </Text>
      </View>

    );
  }
}

//样式表
const styles = StyleSheet.create({
  description: {
    fontSize: 20,
  },
  container: {
    flex: 1,
  }
});

export default Login;